#ifndef INFOS_H
#define INFOS_H

#include "host.h"
#include "tlist.h"

/*
 *	FileInfo
 */
class CFileInfo : public TListObj
{
public:
	CFileInfo( int id = 0 );
	CFileInfo( const CFileInfo& org );
	~CFileInfo();
	CFileInfo& operator= ( const CFileInfo& org );

	int GetId(){ return m_id; }
	void SetId( int id ){ m_id = id; }
	const char* GetFileName(){ return m_fileName ? m_fileName : m_fileNameExt; }
	void SetFileName( const char* fileName ){ if( m_fileName ) free( m_fileName ); m_fileName = (char*)_strdup( fileName ); }
	__int64 GetSize(){ return m_size; }
	void SetSize( __int64 size ){ m_size = size; }
	time_t GetMtime(){ return m_mtime; }
	void SetMtime( time_t mtime ){ m_mtime = mtime; }
	time_t GetAtime(){ return m_atime; }
	void SetAtime( time_t atime ){ m_atime = atime; }
	time_t GetCrtime(){ return m_crtime; }
	void SetCrtime( time_t crtime ){ m_crtime = crtime; }
	UINT GetAttr(){ return m_attr; }
	void SetAttr( UINT attr ){ m_attr = attr; }
	bool IsSelected(){ return m_selected; }
	void SetSelected( bool selected ){ m_selected = selected; }

private:
	int			m_id;
	char*		m_fileName;
	const char* m_fileNameExt;
	UINT		m_attr;
	__int64	m_size;
	time_t	m_mtime;
	time_t	m_atime;
	time_t	m_crtime;
	bool	m_selected;	// for recvDlg;
};

/*
 *	ConnectInfo
 */
struct TConnectInfo : public TListObj
{
	SOCKET	sock;
	ULONG	addr;
	int		port;
	bool	server;
	bool	complete;
	DWORD	startTick;
	DWORD	lastTick;
};

/*
 *	AcceptFileInfo
 */
struct TAcceptFileInfo
{
	CFileInfo*	fileInfo;
	THost*		host;
	__int64		offset;
	int			packetNum;
	UINT		command;
	FILETIME	attachTime;
};

#endif	// INFOS_H